package com.xutong.tongmiao.adapter;

import java.util.List;

import com.xutong.tongmiao.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView.FindListener;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListAdapterMyLog extends BaseAdapter{

	private Context mContext;
	private LayoutInflater inflater;
	private List<String> list;
	
	public ListAdapterMyLog(Context context,List<String> list){
		this.mContext = context;
		this.inflater = LayoutInflater.from(mContext);
		this.list = list;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		try {
			return list.get(arg0);
		} catch (Exception e) {
			return null;
		}
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
		
	}

	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		// TODO Auto-generated method stub
		
		View view;
		
		if(convertView == null){
			view = inflater.inflate(R.layout.list_item_mylog, null);
		}else {
			view = convertView;
		}
		
		TextView tvLIMyLogFileName = (TextView) view.findViewById(R.id.tvLIMyLogFileName);
		
		tvLIMyLogFileName.setText(list.get(position));
		
		return view;
	}

}
